package teamblue.cardex.components;

import java.util.Date;

import teamblue.cardex.R;
import android.widget.ImageView;

public class Card implements Comparable<Card>{
	
	public long id = -1;
	public int icon = -1;
	public Date expire = null;
	public String pin = null;
	public String phone = null;
	public String name = null;
	public String barcode = null;
	public String format = null;
	public String note = null;
	public String url = null;
	public int editable = 1;
	public double balance = -1;
	
	
	public Card(long id, int icon, Date expire, String pin, String phone, String name, 
			String barcode, String format, String note, String url, int editable, double balance){
		this.id =id;
		this.icon = icon;
		this.expire = expire;
		this.pin = pin;
		this.phone = phone;
		this.name = name;
		this.barcode = barcode;
		this.format = format;
		this.note = note;
		this.balance = balance;
		this.url = url;
		this.editable = editable;
	}
	public Card(String name){
		this.name = name;
	}
	@Override
	public String toString(){
		return name;
	}
	public int compareTo(Card card) {
	    return this.name.compareToIgnoreCase(card.name);
	  }
	public boolean equals(Object o){
		return o instanceof Card && ((Card) o).id == this.id && id != -1;
	}
	static public int getIconId(String name){
		if(name.equalsIgnoreCase("Abercrombie & Fitch")) return R.drawable.abercrombie;
		else if(name.equalsIgnoreCase("Ace Hardware")) return R.drawable.ace;
		else if(name.equalsIgnoreCase("Amazon")) return R.drawable.amazon;
		else if(name.equalsIgnoreCase("AMC Theatres")) return R.drawable.amc;
		else if(name.equalsIgnoreCase("Amcal")) return R.drawable.amcal;
		else if(name.equalsIgnoreCase("American Eagle Outfitters")) return R.drawable.americaneagle;
		else if(name.equalsIgnoreCase("Applebees")) return R.drawable.applebees;
		else if(name.equalsIgnoreCase("Arcadia Group Limited")) return R.drawable.arcadia;
		else if(name.equalsIgnoreCase("Argos")) return R.drawable.argos;
		else if(name.equalsIgnoreCase("Babies R Us")) return R.drawable.babiesrus;
		else if(name.equalsIgnoreCase("Banana Republic")) return R.drawable.banana;
		else if(name.equalsIgnoreCase("Barnes and Noble")) return R.drawable.bnob;
		else if(name.equalsIgnoreCase("Bass Pro Shop")) return R.drawable.basspro;
		else if(name.equalsIgnoreCase("Bath & Body Works")) return R.drawable.bathbody;
		else if(name.equalsIgnoreCase("Bed Bath & Beyond")) return R.drawable.bedbath;
		else if(name.equalsIgnoreCase("Best Buy")) return R.drawable.bestbuy;
		else if(name.equalsIgnoreCase("Beverages and More")) return R.drawable.bevmo;
		else if(name.equalsIgnoreCase("Blockbuster")) return R.drawable.blockbuster;
		else if(name.equalsIgnoreCase("Bloomingdales")) return R.drawable.bloomingdales;
		else if(name.equalsIgnoreCase("Body Shop")) return R.drawable.bodyshop;
		else if(name.equalsIgnoreCase("Books-A-Million")) return R.drawable.booksamillion;
		else if(name.equalsIgnoreCase("Boots")) return R.drawable.boots;
		else if(name.equalsIgnoreCase("Borders")) return R.drawable.borders;
		else if(name.equalsIgnoreCase("B&Q")) return R.drawable.bandq;
		else if(name.equalsIgnoreCase("British Home Stores")) return R.drawable.britishhomestores;
		else if(name.equalsIgnoreCase("Brookstone")) return R.drawable.brookstone;
		else if(name.equalsIgnoreCase("Burger King")) return R.drawable.burgerking;
		else if(name.equalsIgnoreCase("Caribou Coffee")) return R.drawable.caribou;
		else if(name.equalsIgnoreCase("Cheesecake Factory")) return R.drawable.cheesecake;
		else if(name.equalsIgnoreCase("Chilis")) return R.drawable.chilis;
		else if(name.equalsIgnoreCase("Chipotle Mexican Grill")) return R.drawable.chipotle;
		else if(name.equalsIgnoreCase("Cineworld Cinemas")) return R.drawable.cineworld;
		else if(name.equalsIgnoreCase("Claire's")) return R.drawable.claires;
		else if(name.equalsIgnoreCase("Coach")) return R.drawable.coach;
		else if(name.equalsIgnoreCase("Comet")) return R.drawable.comet;
		else if(name.equalsIgnoreCase("Continental Airlines")) return R.drawable.continental;
		else if(name.equalsIgnoreCase("Costco")) return R.drawable.costco;
		else if(name.equalsIgnoreCase("Crate & Barrel")) return R.drawable.cratebarrel;
		else if(name.equalsIgnoreCase("CVS")) return R.drawable.cvs;
		else if(name.equalsIgnoreCase("Dave and Busters")) return R.drawable.davebusters;
		else if(name.equalsIgnoreCase("Debenhams")) return R.drawable.debenhams;
		else if(name.equalsIgnoreCase("Delta Airlines")) return R.drawable.delta;
		else if(name.equalsIgnoreCase("Dunkin Donuts")) return R.drawable.dunkin;
		else if(name.equalsIgnoreCase("Eddie Bauer")) return R.drawable.eddiebauer;
		else if(name.equalsIgnoreCase("Empire Cinemas")) return R.drawable.empire;
		else if(name.equalsIgnoreCase("Espresso Royale")) return R.drawable.espresso;
		else if(name.equalsIgnoreCase("Express")) return R.drawable.express;
		else if(name.equalsIgnoreCase("FlyBuys")) return R.drawable.flybuys;
		else if(name.equalsIgnoreCase("Foot Locker")) return R.drawable.footlocker;
		else if(name.equalsIgnoreCase("Game")) return R.drawable.game;
		else if(name.equalsIgnoreCase("GameStop")) return R.drawable.gamestop;
		else if(name.equalsIgnoreCase("Gap")) return R.drawable.gap;
		else if(name.equalsIgnoreCase("Giant Eagle")) return R.drawable.gianteagle;
		else if(name.equalsIgnoreCase("Giant Food Stores")) return R.drawable.giant;
		else if(name.equalsIgnoreCase("Gymboree")) return R.drawable.gymboree;
		else if(name.equalsIgnoreCase("Habitat")) return R.drawable.habitat;
		else if(name.equalsIgnoreCase("Hallmark")) return R.drawable.hallmark;
		else if(name.equalsIgnoreCase("HMV")) return R.drawable.hmv;
		else if(name.equalsIgnoreCase("Hollister Co")) return R.drawable.hollister;
		else if(name.equalsIgnoreCase("Hollywood Video")) return R.drawable.hollywood;
		else if(name.equalsIgnoreCase("Home Depot")) return R.drawable.homedepot;
		else if(name.equalsIgnoreCase("Homebase")) return R.drawable.homebase;
		else if(name.equalsIgnoreCase("House of Fraser")) return R.drawable.houseoffraser;
		else if(name.equalsIgnoreCase("Hot Topic")) return R.drawable.hottopic;
		else if(name.equalsIgnoreCase("Ingles Markets")) return R.drawable.ingles;
		else if(name.equalsIgnoreCase("iTunes")) return R.drawable.itunes;
		else if(name.equalsIgnoreCase("J Crew")) return R.drawable.jcrew;
		else if(name.equalsIgnoreCase("JC Penney")) return R.drawable.jcpenney;
		else if(name.equalsIgnoreCase("Jimmy Johns")) return R.drawable.jimmyjohns;
		else if(name.equalsIgnoreCase("Kmart")) return R.drawable.kmart;
		else if(name.equalsIgnoreCase("Kohls")) return R.drawable.kohls;
		else if(name.equalsIgnoreCase("Kroger")) return R.drawable.kroger;
		else if(name.equalsIgnoreCase("LL Bean")) return R.drawable.llbean;
		else if(name.equalsIgnoreCase("Lowes")) return R.drawable.lowes;
		else if(name.equalsIgnoreCase("Macys")) return R.drawable.macys;
		else if(name.equalsIgnoreCase("Marriott")) return R.drawable.marriott;
		else if(name.equalsIgnoreCase("Marshalls")) return R.drawable.marshalls;
		else if(name.equalsIgnoreCase("Mastercard Gift Card")) return R.drawable.mastercard;
		else if(name.equalsIgnoreCase("McCormick and Schmicks")) return R.drawable.mccormicks;
		else if(name.equalsIgnoreCase("McDonalds")) return R.drawable.mcdonalds;
		else if(name.equalsIgnoreCase("Men's Wearhouse")) return R.drawable.menswearhouse;
		else if(name.equalsIgnoreCase("Michaels")) return R.drawable.michaels;
		else if(name.equalsIgnoreCase("Nectar")) return R.drawable.nectar;
		else if(name.equalsIgnoreCase("Neiman Marcus")) return R.drawable.neiman;
		else if(name.equalsIgnoreCase("New Look")) return R.drawable.newlook;
		else if(name.equalsIgnoreCase("Nike")) return R.drawable.nike;
		else if(name.equalsIgnoreCase("Nordstrom")) return R.drawable.nordstrom;
		else if(name.equalsIgnoreCase("Office Depot")) return R.drawable.officedepot;
		else if(name.equalsIgnoreCase("Office Max")) return R.drawable.officemax;
		else if(name.equalsIgnoreCase("Old Navy")) return R.drawable.oldnavy;
		else if(name.equalsIgnoreCase("Olive Garden")) return R.drawable.olivegarden;
		else if(name.equalsIgnoreCase("Outback Steakhouse")) return R.drawable.outback;
		else if(name.equalsIgnoreCase("Panera")) return R.drawable.panera;
		else if(name.equalsIgnoreCase("Peet's Coffee & Tea")) return R.drawable.peets;
		else if(name.equalsIgnoreCase("Pizza Express")) return R.drawable.pizzaexpress;
		else if(name.equalsIgnoreCase("Pizza Hut")) return R.drawable.pizzahut;
		else if(name.equalsIgnoreCase("Plum Market")) return R.drawable.plummarket;
		else if(name.equalsIgnoreCase("Potter Barn")) return R.drawable.potterybarn;
		else if(name.equalsIgnoreCase("Priceline")) return R.drawable.priceline;
		else if(name.equalsIgnoreCase("Priority Club")) return R.drawable.priorityclub;
		else if(name.equalsIgnoreCase("Publix")) return R.drawable.publix;
		else if(name.equalsIgnoreCase("Pulse")) return R.drawable.pulse;
		else if(name.equalsIgnoreCase("Quiznos")) return R.drawable.quiznos;
		else if(name.equalsIgnoreCase("Radio Shack")) return R.drawable.radioshack;
		else if(name.equalsIgnoreCase("Red Lobster")) return R.drawable.redlobster;
		else if(name.equalsIgnoreCase("Regal Cinemas")) return R.drawable.regal;
		else if(name.equalsIgnoreCase("REI")) return R.drawable.rei;
		else if(name.equalsIgnoreCase("Rite Aid")) return R.drawable.riteaid;
		else if(name.equalsIgnoreCase("Rugby Store")) return R.drawable.therugbystore;
		else if(name.equalsIgnoreCase("Safeway")) return R.drawable.safeway;
		else if(name.equalsIgnoreCase("Sainsbury's")) return R.drawable.sainsburys;
		else if(name.equalsIgnoreCase("Saks Fifth Avenue")) return R.drawable.saks;
		else if(name.equalsIgnoreCase("Sams Club")) return R.drawable.sams;
		else if(name.equalsIgnoreCase("Sears")) return R.drawable.sears;
		else if(name.equalsIgnoreCase("Sephora")) return R.drawable.sephora;
		else if(name.equalsIgnoreCase("Shaw's Supermarkets")) return R.drawable.shaws;
		else if(name.equalsIgnoreCase("Shell")) return R.drawable.shell;
		else if(name.equalsIgnoreCase("Southwest Airlines")) return R.drawable.southwest;
		else if(name.equalsIgnoreCase("Speedway")) return R.drawable.speedway;
		else if(name.equalsIgnoreCase("Sports Authority")) return R.drawable.sportsauthority;
		else if(name.equalsIgnoreCase("Staples")) return R.drawable.staples;
		else if(name.equalsIgnoreCase("Starbucks")) return R.drawable.starbucks;
		else if(name.equalsIgnoreCase("Subway")) return R.drawable.subway;
		else if(name.equalsIgnoreCase("Sunglass Hut")) return R.drawable.sunglasshut;
		else if(name.equalsIgnoreCase("Talbots")) return R.drawable.talbots;
		else if(name.equalsIgnoreCase("Target")) return R.drawable.target;
		else if(name.equalsIgnoreCase("Tesco")) return R.drawable.tesco;
		else if(name.equalsIgnoreCase("TGI Fridays")) return R.drawable.tgif;
		else if(name.equalsIgnoreCase("Tiffany & Co.")) return R.drawable.tiffany;
		else if(name.equalsIgnoreCase("TJ Maxx")) return R.drawable.tjmaxx;
		else if(name.equalsIgnoreCase("Toys R Us")) return R.drawable.toysrus;
		else if(name.equalsIgnoreCase("Trader Joes")) return R.drawable.traderjoes;
		else if(name.equalsIgnoreCase("Urban Outfitters")) return R.drawable.urbanoutfitters;
		else if(name.equalsIgnoreCase("Victorias Secret")) return R.drawable.victorias;
		else if(name.equalsIgnoreCase("Visa Gift Card")) return R.drawable.visa;
		else if(name.equalsIgnoreCase("Walgreens")) return R.drawable.walgreens;
		else if(name.equalsIgnoreCase("Walmart")) return R.drawable.walmart;
		else if(name.equalsIgnoreCase("Weis Markets")) return R.drawable.weis;
		else if(name.equalsIgnoreCase("Wegmans")) return R.drawable.wegmans;
		else if(name.equalsIgnoreCase("Wendys")) return R.drawable.wendys;
		else if(name.equalsIgnoreCase("WHSmith")) return R.drawable.whsmith;
		else if(name.equalsIgnoreCase("Winn Dixie")) return R.drawable.winndixie;
		else if(name.equalsIgnoreCase("Woolworths")) return R.drawable.woolworths;
		else if(name.equalsIgnoreCase("YMCA")) return R.drawable.ymca;
		else if(name.equalsIgnoreCase("Zingermans")) return R.drawable.zingermans;

		else return R.drawable.logo_light_blue;
	}
	
	static public void setIcon(int code, ImageView icon_view, String name, int editable){
		switch(code){
		case 0:
			if(editable == 1) icon_view.setImageResource(R.drawable.logo_light_blue);
			else icon_view.setImageResource(getIconId(name));
			break;
		case 1:icon_view.setImageResource(R.drawable.logo_black);
			break;
		case 2:icon_view.setImageResource(R.drawable.logo_blue);
			break;
		case 3:icon_view.setImageResource(R.drawable.logo_light_blue);
			break;
		case 4:icon_view.setImageResource(R.drawable.logo_green);
			break;
		case 5:icon_view.setImageResource(R.drawable.logo_orange);
			break;
		case 6:icon_view.setImageResource(R.drawable.logo_pink);
			break;
		case 7:icon_view.setImageResource(R.drawable.logo_purple);
			break;
		case 8:icon_view.setImageResource(R.drawable.logo_red);
			break;
		case 9:icon_view.setImageResource(R.drawable.logo_yellow);
			break;
		default:icon_view.setImageResource(R.drawable.logo_light_blue);
			break;
		}
	}
}
